package com.person.tb.HUtils;

import com.lidroid.xutils.HttpUtils;
import com.lidroid.xutils.http.client.HttpRequest;
import com.person.tbsystem.globarVar.TbConstants;
import com.lidroid.xutils.http.callback.RequestCallBack;
import org.apache.http.protocol.HTTP;

/**
 * Created by ct-xie on 2015/12/30.
 */
public class TBhttpUtls {
    private static HttpUtils mHttpUtils;
    private static int mTimeout=10000;


    /**
     * @return 返回httpUtls对象
     */
    public static TBhttpUtls getHttpInstance() {
        mHttpUtils = new HttpUtils();
        mHttpUtils.configSoTimeout(mTimeout);
        mHttpUtils.configResponseTextCharset(HTTP.UTF_8);
        return new TBhttpUtls();
    }

    /**
     * get请求 用于请求数据
     *
     * @param face_name
     * @param callback
     */
    public void get(String face_name, RequestCallBack callback) {
        mHttpUtils.send(HttpRequest.HttpMethod.GET, TbConstants.HOST_URL + face_name, callback);
    }

}
